import java.io.DataOutputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.net.Socket;
import java.net.UnknownHostException;

public class FileOnlyClient {

	private static Socket socket;

	public FileOnlyClient(){
	}


		public void run(String host, int port, String filePath, String shortFileName) throws IOException{
			socket = new Socket(host, port);
			System.out.println("connection to " + socket);

			System.out.println("Send File begins...");
			FileInputStream is = new FileInputStream(filePath);
			DataOutputStream dout = new DataOutputStream (socket.getOutputStream());			
			// write the file name
			dout.writeUTF(shortFileName);
			// short file name and full path
			int c;
			while ((c = is.read()) != -1) {
				dout.write(c);
			}
			
			System.out.println("Close file...");
		}
	}

	/*public static void main(String[] args) throws IOException {

		String host = args[0];
		int port = Integer.parseInt(args[1]);
		String fileName = args[2];
		new FileOnlyClient(host, port, fileName);
	}
	*/


	
